package com.knowswift.common.enums;

import java.util.Arrays;


public enum RoleEnum {

    ROLE_ADMIN,

    ROLE_USER,
    /**
     * 游客
     */
    ROLE_VISITOR;

    public static RoleEnum find(String name) {

        return Arrays.stream(RoleEnum.values()).filter(i -> i.name().equals(name)).findFirst().orElse(null);
    }

    public static boolean isVisitor(String name) {
        return RoleEnum.ROLE_VISITOR.name().equals(name);
    }

    public static boolean isAdmin(String name) {
        return RoleEnum.ROLE_ADMIN.name().equals(name);
    }
}
